//package com.tx.test.config;
//
//import org.apache.commons.dbcp.BasicDataSource;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//
//@Configuration
//@MapperScan(basePackages = "com.tx.test.mapper")
//public class Config {
//	@Bean
//	public BasicDataSource dataSource() {
//		BasicDataSource dataSource = new BasicDataSource();
//		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
//		dataSource.setUrl("jdbc:mysql://192.168.23.129:3306/product?useUnicode=true&characterEncoding=utf-8");//防止乱码
//		dataSource.setUsername("root");
//		dataSource.setPassword("root");
//		dataSource.setInitialSize(5);
//		dataSource.setMaxActive(10);
//		return dataSource;
//	}
//
//	@Bean
//	public DataSourceTransactionManager transactionManager() {
//		return new DataSourceTransactionManager(dataSource());
//	}
//
//	@Bean
//	public SqlSessionFactoryBean sqlSessionFactory() throws Exception {
//		SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
//		sessionFactory.setDataSource(dataSource());
////		sessionFactory.setTypeAliasesPackage("com.tx.test");
//		sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:userMapper.xml"));
//		return sessionFactory;
//	}
//}
